home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 58 / pcpp58a.iso / extras / quake 3 source / Q3A_ToolSource.exe / Main / cmdlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-02  |  3.4 KB  |  140 lines

  1. // cmdlib.h
  2.  
  3. #ifndef __CMDLIB__
  4. #define __CMDLIB__
  5.  
  6. #ifdef _WIN32
  7. #pragma warning(disable : 4244)     // MIPS
  8. #pragma warning(disable : 4136)     // X86
  9. #pragma warning(disable : 4051)     // ALPHA
  10.  
  11. #pragma warning(disable : 4018)     // signed/unsigned mismatch
  12. #pragma warning(disable : 4305)     // truncate from double to float
  13.  
  14. #pragma check_stack(off)
  15.  
  16. #endif
  17.  
  18. #include <stdio.h>
  19. #include <string.h>
  20. #include <stdlib.h>
  21. #include <errno.h>
  22. #include <ctype.h>
  23. #include <time.h>
  24. #include <stdarg.h>
  25.  
  26. #ifdef _WIN32
  27.  
  28. #pragma intrinsic( memset, memcpy )
  29.  
  30. #endif
  31.  
  32. #ifndef __BYTEBOOL__
  33. #define __BYTEBOOL__
  34. typedef enum { qfalse, qtrue } qboolean;
  35. typedef unsigned char byte;
  36. #endif
  37.  
  38. #define    MAX_OS_PATH        1024
  39. #define MEM_BLOCKSIZE 4096
  40.  
  41. // the dec offsetof macro doesnt work very well...
  42. #define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
  43.  
  44.  
  45. // set these before calling CheckParm
  46. extern int myargc;
  47. extern char **myargv;
  48.  
  49. char *strupr (char *in);
  50. char *strlower (char *in);
  51. int Q_strncasecmp( const char *s1, const char *s2, int n );
  52. int Q_stricmp( const char *s1, const char *s2 );
  53. void Q_getwd( char *out );
  54.  
  55. int Q_filelength (FILE *f);
  56. int    FileTime( const char *path );
  57.  
  58. void    Q_mkdir( const char *path );
  59.  
  60. extern    char        qdir[1024];
  61. extern    char        gamedir[1024];
  62. extern  char        writedir[1024];
  63. void SetQdirFromPath( const char *path );
  64. char *ExpandArg( const char *path );    // from cmd line
  65. char *ExpandPath( const char *path );    // from scripts
  66. char *ExpandGamePath (const char *path);
  67. char *ExpandPathAndArchive( const char *path );
  68.  
  69.  
  70. double I_FloatTime( void );
  71.  
  72. void    Error( const char *error, ... );
  73. int        CheckParm( const char *check );
  74.  
  75. FILE    *SafeOpenWrite( const char *filename );
  76. FILE    *SafeOpenRead( const char *filename );
  77. void    SafeRead (FILE *f, void *buffer, int count);
  78. void    SafeWrite (FILE *f, const void *buffer, int count);
  79.  
  80. int        LoadFile( const char *filename, void **bufferptr );
  81. int   LoadFileBlock( const char *filename, void **bufferptr );
  82. int        TryLoadFile( const char *filename, void **bufferptr );
  83. void    SaveFile( const char *filename, const void *buffer, int count );
  84. qboolean    FileExists( const char *filename );
  85.  
  86. void     DefaultExtension( char *path, const char *extension );
  87. void     DefaultPath( char *path, const char *basepath );
  88. void     StripFilename( char *path );
  89. void     StripExtension( char *path );
  90.  
  91. void     ExtractFilePath( const char *path, char *dest );
  92. void     ExtractFileBase( const char *path, char *dest );
  93. void    ExtractFileExtension( const char *path, char *dest );
  94.  
  95. int     ParseNum (const char *str);
  96.  
  97. short    BigShort (short l);
  98. short    LittleShort (short l);
  99. int        BigLong (int l);
  100. int        LittleLong (int l);
  101. float    BigFloat (float l);
  102. float    LittleFloat (float l);
  103.  
  104.  
  105. char *COM_Parse (char *data);
  106.  
  107. extern    char        com_token[1024];
  108. extern    qboolean    com_eof;
  109.  
  110. char *copystring(const char *s);
  111.  
  112.  
  113. void CRC_Init(unsigned short *crcvalue);
  114. void CRC_ProcessByte(unsigned short *crcvalue, byte data);
  115. unsigned short CRC_Value(unsigned short crcvalue);
  116.  
  117. void    CreatePath( const char *path );
  118. void    QCopyFile( const char *from, const char *to );
  119.  
  120. extern    qboolean        archive;
  121. extern    char            archivedir[1024];
  122.  
  123.  
  124. extern    qboolean verbose;
  125. void qprintf( const char *format, ... );
  126. void _printf( const char *format, ... );
  127.  
  128. void ExpandWildcards( int *argc, char ***argv );
  129.  
  130.  
  131. // for compression routines
  132. typedef struct
  133. {
  134.     void    *data;
  135.     int        count, width, height;
  136. } cblock_t;
  137.  
  138.  
  139. #endif
  140.